import request from "@/utils/request";

// 创建试卷信息
export function createExamination(data) {
  return request({
    url: "/exam/examination/create",
    method: "post",
    data: data
  });
}

// 更新试卷信息
export function updateExamination(data) {
  return request({
    url: "/exam/examination/update",
    method: "put",
    data: data
  });
}

// 删除试卷信息
export function deleteExamination(id) {
  return request({
    url: "/exam/examination/delete?id=" + id,
    method: "delete"
  });
}

// 获得试卷信息
export function getExamination(id) {
  return request({
    url: "/exam/examination/get?id=" + id,
    method: "get"
  });
}

// 获得试卷信息分页
export function getExaminationPage(query) {
  return request({
    url: "/exam/examination/page",
    method: "get",
    params: query
  });
}

// 导出试卷信息 Excel
export function exportExaminationExcel(query) {
  return request({
    url: "/exam/examination/export-excel",
    method: "get",
    params: query,
    responseType: "blob"
  });
}

// 创建考试题目
export function createExaminationSubject(data) {
  return request({
    url: "/exam/examination-subject/create",
    method: "post",
    data: data
  });
}

// 更新考试题目
export function updateExaminationSubject(data) {
  return request({
    url: "/exam/examination-subject/update",
    method: "put",
    data: data
  });
}

// 获得试全部题目列表
export function getExaminationSubjectList(id) {
  return request({
    url: "/exam/examination/" + id + "/subjectIds",
    method: "get"
  });
}

//根据ID删除考试题目
export function deleteExaminationSubject(id) {
  return request({
    url: "/exam/examination-subject/delete?id=" + id,
    method: "delete"
  });
}

//随机抽取自动组卷
export function aoToExaminationSubject(data) {
  return request({
    url: "/exam/examination-subject/randomAddSubject",
    method: "post",
    data: data
  });
}
